QSI, INC CC - Dispatch No. <?=$model->dispatch?> has been setup for automatic alerts!
************************
Customer No: <?=$model->custno?>

Location No: <?=$model->locno?>

<?=$model->getLocation()->locname?>

<?=$model->getLocation()->add1?>

<?=$model->getLocation()->city;?>, <?=$model->getLocation()->state;?> <?=$model->getLocation()->zip;?>

Tech: <?php
$errorFlag = false;

$tech = $model->lastestTech;
if (empty($tech)) {
    $errorFlag = true;
} else {
    $employee = Employees::model()->findByPk($tech->empno);
    if (empty($employee)) $errorFlag = true;
}
?>
<?php
if ($errorFlag):
    ?>
    No Data Found
<?php
else:
 echo "$employee->firstname $employee->lastname" ?>
<?php endif; ?>

Status:  <?php if (!empty($model->lastestTech->status)) echo $model->lastestTech->status;   else echo 'Pending';?>

***************************

Dispatch Notes:

<?= $model->notes ?>
<?php
$crit = new CDbCriteria();
$crit->condition = "dispatch=:dispatch and empno IS NULL AND custno !=''";
$crit->params = array(
    'dispatch' => $model->dispatch
);
$notesList = Notes::model()->findAll($crit);
?>

Customer Notes:

<?php foreach($notesList as $item): ?>
<?=$item->note.' - on '.$item->dateofnote	. ' at '.$item->time.' by '.$item->name?>
<?php endforeach;?>

<?php
$crit = new CDbCriteria();
$crit->condition = "dispatch=:dispatch and custno IS NULL and private IS NULL or private !=1";
$crit->params = array(
    'dispatch' => $model->dispatch
);
$notesList = Notes::model()->findAll($crit);
?>
Tech Notes:

<?php foreach($notesList as $item): ?>
<?=$item->note.' - on '.$item->dateofnote	. ' at '.$item->time.' by '.Employees::getEmployeeName($item->empno)?>
<?php endforeach;?>

****************************************************

Best Regards,

QSI, INC


